﻿
//全选/全消
function selectAll() {
    var val = document.getElementById("chkSelectAll");
    var rowob = document.getElementsByName("chkRowName"); //.getElementsByName("contractRow");
    var rowcount = rowob.length;

    for (var i = 1; i < rowcount; i++) {
        rowob[i].checked = val.checked;
    }
}

//文本框输入只能为非负数
function txtIsNumber(txtID, str) {
    var a = document.getElementById(txtID).value;
    var flag = true;
    if (!(Math.abs(a) == a) || a == "") {
        alert("只能是非负数,也不能为空-Not less than zero！");
        document.getElementById(txtID).value = "0";
        document.getElementById(txtID).focus();
        return false;
    }
    a = document.getElementById(txtID).value;
    if (flag && a > 0) {
        if (str > 0 && str < a) {
            document.getElementById(txtID).value = str;
            alert("bigger！");
            return false
        }
        return true;
    }
}

function showHiddentxtddl(n, txtID, dllID) {
    if (n == 1) {
        document.getElementById(txtID).style.display = "";
        document.getElementById(dllID).style.display = "none";
    }
    else {
        document.getElementById(txtID).style.display = "none";
        document.getElementById(dllID).style.display = "";
    }
}

function showDdl(strID1, strID2, strID3, strID4) {
    showHidden(strID1, strID2, strID3, strID4);
    var v = document.getElementById(strID1).value;
    if (v == "-1") {
        v = "";
    }
    document.getElementById(strID3).value = v;
//    alert(document.getElementById(strID1).value);
}
function showHidden(strID, strID1, strID2, strID3) {
    document.getElementById(strID).style.display = "none";
    document.getElementById(strID1).style.display = "none";
    document.getElementById(strID2).style.display = "";
    document.getElementById(strID3).style.display = "";
}

function deliveryOnload() {
    document.getElementById("ddlSaleName").style.display = "none";
    document.getElementById("txtSaleName").style.display = "";
    document.getElementById("ddlSoNo").style.display = "none";
    document.getElementById("txtSoNo").style.display = "";
    document.getElementById("ddlContractNo").style.display = "none";
    document.getElementById("txtContractNo").style.display = "";
    document.getElementById("imgSaleName").style.display = "none";
    document.getElementById("imgSoNo").style.display = "none";
}
function deliveryOnloadApply() {
    document.getElementById("ddlSaleName").style.display = "none";
    document.getElementById("txtSaleName").style.display = "";
    document.getElementById("imgSaleName").style.display = "";
    document.getElementById("ddlCustomer").style.display = "none";
    document.getElementById("txtCustomer").style.display = "";
    document.getElementById("imgCustomer").style.display = "";
    document.getElementById("ddlSoNo").style.display = "none";
    document.getElementById("txtSoNo").style.display = "";
    document.getElementById("imgSoNo").style.display = "";
    document.getElementById("ddlContractNo").style.display = "none";
    document.getElementById("txtContractNo").style.display = "";
    document.getElementById("imgContractNo").style.display = "";
    document.getElementById("ddlContractNoCustomer").style.display = "none";
    document.getElementById("txtContractNoCustomer").style.display = "";
    document.getElementById("imgPlantSoNo").style.display = "";
    document.getElementById("ddlPlantSoNo").style.display = "none";
    document.getElementById("txtPlantSoNo").style.display = "";
    document.getElementById("imgContractNoCustomer").style.display = "";
}

function showOrHidden(strID, str) {
    document.getElementById(strID).style.display = str;
}


//function IncasementUploadFileCheck(str) {
//    var filePath = document.getElementById("FileUpload1").value;
//    var fileName = filePath.substring(filePath.lastIndexOf('/') + 1, filePath.length);
//    var contractNo = document.getElementById("txtContractNo").value;
//    var soNo = document.getElementById("txtSoNo").value;
//    if (fileName.length > 0 && contractNo.length > 0 && soNo.length > 0) {
//        var aa = DeliveryApplyWebService;
//        aa.ChechFile(fileName, contractNo, soNo, IncasementUploadFileCheckResult);
//        aa.
////        document.getElementById("txtSaleName").value = fileName;
////        alert("contractNo" + contractNo+"--"+filePath + "---" + fileName);
////        return false;
//    }
//    else {
//        alert("File Name & ContractNo & SoNo cannot null!");
//        return false;
//    }
//}
//function IncasementUploadFileCheckResult(result) {
//    return !result;
//}